<template>
  <el-dialog :title="$t('letterReviewOrder.letterRecord')" :visible.sync="showState" :before-close="closeSubmit" :close-on-click-modal="false">
    <letter-review v-loading="loading" :credit-order-no="creditOrderNo" :letter-record-data="letterRecordData" />
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="closeSubmit">{{ $t('common.operate.sure') }}</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { riskAuditDetail } from '@/api/risk'
import letterReview from '@/components/auth/letter-review'
export default {
  name: 'LetterReviewRecord',
  components: {
    letterReview
  },
  props: {
    showDialog: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      loading: true,
      letterRecordData: [],
      creditOrderNo: null
    }
  },
  computed: {
    showState: {
      get: function() {
        return this.showDialog
      },
      set: function() {
      }
    }
  },
  methods: {
    getData(id) {
      const params = {
        creditOrderId: id
      }
      riskAuditDetail(params)
        .then(res => {
          this.loading = false
          if (res.success) {
            this.creditOrderNo = res.data['creditOrderNO']
            this.letterRecordData = res.data['creditOrderOperateRecordVOS']
          } else {
            this.$message.error(res.message)
          }
        })
        .catch(err => {
          this.loading = false
          this.$message.error(err.message)
        })
    },
    closeSubmit() {
      this.$emit('change-dialog', false)
    }
  }
}
</script>

<style scoped>

</style>
